package com.liyz.testmodule.service.impl;

import com.liyz.common.util.R;
import com.liyz.common.vo.UserVO;
import com.liyz.testmodule.feign.UserClient;
import com.liyz.testmodule.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class HelloServiceImpl implements HelloService {


    @Autowired
    UserClient userClient;

    @Override
    public Object hello(Integer id) {
        UserVO user = userClient.get(id);
        R retCell = new R();
        if(user.getId() == -1) {
            retCell.setCode(R.FAIL);
            retCell.setMsg("服务器错误，请稍后！");
            return retCell;
        }
        retCell.setData(user);
        return retCell;
    }
}
